ÄúµÄλÖãºÑ°ÃÎÍøÊ×Ò³£¾±à³ÌÀÖÔ°£¾VBScript£¾VBScript


objects constants operators statements functions properties methods






STATEMENT:  Class

Class ... End Class

VBScript 5.0

The Class statement block is used to create a Class object. You can only create (name) one Class object with each Class statement. This ability to create your own Class is a significant expansion of the usefulness of the VBScript language.

Within the block of the Class statement you can declare the members of the class, which are variables, methods, and properties. Methods of the class are implemented by defining Sub or Function procedures, while properties are defined through the use of Property Get, Property Let, and Property Set statements. Any member of a class may be declared as either Public or Private, with a Public declaration being the default state. Private members of a class are only accessable by other members of the same class, while Public members are accessable by anything, inside or outside of the scope of the class.

The Class statement must always end with an End Class.

Example:
<%
Class YourClassObjectName
   Private DataMember

   Public Sub
      [...statements...]
   End Sub

   Public Property Let
      [...statements...]
   End Property

   Public Property Get
      [...statements...]
   End Property
End Class
%>